#!/bin/bash
/bin/launchctl unload /System/Library/LaunchDaemons/com.bigboss.sbsettingsd.plist

rm /var/mobile/Library/SBSettings/Toggles/Silent/SilentToggle.pid
cp /var/mobile/Library/SBSettings/Toggles/Silent/SoundOn/CategoriesThatShareVolumes.plist /System/Library/PrivateFrameworks/Celestial.framework/CategoriesThatShareVolumes.plist
cp /var/mobile/Library/SBSettings/Toggles/Silent/SoundOn/CategoryMinimumVolumes.plist /System/Library/PrivateFrameworks/Celestial.framework/CategoryMinimumVolumes.plist
cp /var/mobile/Library/SBSettings/Toggles/Silent/SoundOn/RegionalVolumeLimits.plist /System/Library/PrivateFrameworks/Celestial.framework/RegionalVolumeLimits.plist
cp /var/mobile/Library/SBSettings/Toggles/Silent/SoundOn/SystemSoundBehaviour.plist /System/Library/PrivateFrameworks/Celestial.framework/SystemSoundBehaviour.plist
/var/mobile/Library/SBSettings/Toggles/Silent/ringtonevolumehelper /var/mobile/Library/Preferences/com.apple.celestial.plist `/var/mobile/Library/SBSettings/Toggles/Silent/ringtonevolumehelper /var/mobile/Library/SBSettings/Toggles/Silent/SilentToggleVolumeSettings.plist`
chown mobile:mobile /var/mobile/Library/Preferences/com.apple.celestial.plist
launchctl unload /System/Library/LaunchDaemons/com.apple.mediaserverd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.mediaserverd.plist

declare -a cydia
cydia=($CYDIA)

if [[ $1 == remove ]]; then
    if [[ ${CYDIA+@} ]]; then
        eval "echo 'finish:restart' >&${cydia[0]}"
    fi
fi
exit 0
 
